---
layout: single
property_name: width
---

<section id="width" class="property">
  <header class="property-header">
    <nav class="property-links">
        <a class="property-collection" href="{{site.url}}/box-model/">
          In collection: <strong>box-model</strong>
        </a>
      <a class="property-links-direct" href="{{site.url}}/property/width/" data-property-name="width" data-tooltip="Single page for this property">Permalink</a>
      <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="width">Share</a>
      <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/width" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a>
    </nav>
    <h2 class="property-name">
      <a href="#width"><span>#</span>width</a>
    </h2>
    <div class="property-description">
      <p>Defines the width of the element.</p>

    </div>

  </header>





    <section class="example">
      <header class="example-header">
        <p class="example-name">
            <code class="example-default" data-tooltip="This is the property's default value">default</code>


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="width: auto;">width: auto;</code>
        </p>
        <div class="example-description">
          <p>The element will <strong>automatically</strong> adjust its width to allow its content to be displayed correctly.</p>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div width  block block--alpha" id="width-auto">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut. Maecenas imperdiet felis nisi, fringilla luctus felis hendrerit sit amet.</div>
        </div>
      </aside>
          <style type="text/css">#width-auto{ width:auto;}</style>
    </section>
    <section class="example">
      <header class="example-header">
        <p class="example-name">


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="width: 240px;">width: 240px;</code>
        </p>
        <div class="example-description">
          <p>You can use <strong>numeric values</strong> like <strong>pixels</strong>, <strong>(r)em</strong>, <strong>percentages</strong>...</p>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div width  block block--alpha" id="width-240px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut. Maecenas imperdiet felis nisi, fringilla luctus felis hendrerit sit amet.</div>
        </div>
      </aside>
          <style type="text/css">#width-240px{ width:240px;}</style>
    </section>
    <section class="example">
      <header class="example-header">
        <p class="example-name">


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="width: 50%;">width: 50%;</code>
        </p>
        <div class="example-description">
          <p>If you use <strong>percentages</strong>, the value is relative to the container&#39;s width.</p>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div width  block block--alpha" id="width-50">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper diam at erat pulvinar, at pulvinar felis blandit. Vestibulum volutpat tellus diam, consequat gravida libero rhoncus ut. Maecenas imperdiet felis nisi, fringilla luctus felis hendrerit sit amet.</div>
        </div>
      </aside>
          <style type="text/css">#width-50{ width:50%;}</style>
    </section>

</section>
